package com.yanyu.space.file.feign.fallback;

import com.yanyu.space.common.core.bean.web.R;
import com.yanyu.space.file.bean.bo.*;
import com.yanyu.space.file.feign.IFileClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

/**
 * @author yanyu
 */
@Slf4j
public class FileClientFallbackFactory implements FallbackFactory<IFileClient> {

    @Override
    public IFileClient create(Throwable cause) {
        return new IFileClient() {
            @Override
            public R<List<FileInfoBo>> directUpload(FileDirectSearchBo bo) {
                log.error("{}",cause.getCause());
                return null;
            }

            @Override
            public R<FileShardingInfoBo> shardingUpload(FileShardingSearchBo bo) {
                log.error("{}",cause.getCause());
                return null;
            }

            @Override
            public R<FileInfoBo> shardingMergeUpload(FileShardingMergeSearchBo bo) {
                log.error("{}",cause.getCause());
                return null;
            }
        };
    }
}
